/*
 *        M   M  M  MMM                     UUU
 *        M   M M M M M                     U    U   U
 *   WWWW M M M M M MMM                     U   UUU UUU WWWW
 *   WWWW MM MM MMM MM                      U    U   U  WWWW
 *   WW   M   M M M M M       HH HH         UUU           WW
 *   WW                       HH HH                       WW
 *   WW MM  MM   MM   HH      HH HH      HH MMMMMM MMMMMM WW
 *   WW MM  MM   MM   HH      HH HH      HH MMMMMM MMMMMM WW
 *   WW MM  MM MM  MM HHHH  HHHH HHHH  HHHH MM     MM  MM WW
 *   WW MM  MM MM  MM HHHH  HHHH HHHH  HHHH MM     MM  MM WW
 * WW   MMMMMM MM  MM HH  HH  HH HH  HH  HH MMMM   MMMMMM   WW
 * WW   MMMMMM MM  MM HH  HH  HH HH  HH  HH MMMM   MMMMMM   WW
 *   WW MM  MM MMMMMM HH      HH HH      HH MM     MMMM   WW
 *   WW MM  MM MMMMMM HH      HH HH      HH MM     MMMM   WW
 *   WW MM  MM MM  MM HH      HH HH      HH MMMMMM MM  MM WW
 *   WW MM  MM MM  MM HH      HH HH      HH MMMMMM MM  MM WW
 *   WW                       HH HH                       WW
 *   WW                       HH HH                       WW
 *   WWWW                     HH HH                     WWWW
 *   WWWW                     HH HH                     WWWW
 *                            HH HH
 *                            HH HH NNN NNN NNN NNN NNN NNN NNN
 *                            HH HH N N N N N N   N N   N    N
 *                            HH HH NNN NNN N N N N NN  N    N
 *                                  N   NN  N N N N N   N    N
 *                                N N   N N NNN NNN NNN NNN  N
 *
 * ParallelSortContainerMergerTask.hpp
 *
 *  Created on: Oct 27, 2010
 *      Author: Felipe Wannmacher
 *	   License: LGPL - http://http://www.gnu.org/licenses/lgpl.html
 */

#ifndef __WarHammer_sort_thread_PARALLELSORTCONTAINERMERGERTASK_HPP__
#define __WarHammer_sort_thread_PARALLELSORTCONTAINERMERGERTASK_HPP__

#include <utility>
#include "../util/Comparator.hpp"
#include "../util/OrderedContentArrayMerger.hpp"
#include "../../util/IFunctor.hpp"

namespace WarHammer
{
	namespace sort
	{
		namespace thread
		{

			template<typename Content>
			class ParallelSortContainerMergerTask: public WarHammer::util::IFunctor<bool>
			{
			private:
				Content* _container,
					   * _swapContainer;
				std::pair<unsigned int, unsigned int>* _firstContainerDelimiter,
													 * _secondContainerDelimiter;
				unsigned int _begin,
							 _end;
				WarHammer::sort::util::Comparator<Content>* _comparator;
				WarHammer::sort::util::OrderedContentArrayMerger<Content>* _orderedContentArrayMerger;
			public:
				ParallelSortContainerMergerTask(Content* container, Content* swapContainer, std::pair<unsigned int, unsigned int>* firstContainerDelimiter, std::pair<unsigned int, unsigned int>* secondContainerDelimiter, unsigned int begin, unsigned int end, WarHammer::sort::util::Comparator<Content>* comparator, WarHammer::sort::util::OrderedContentArrayMerger<Content>* orderedContentArrayMerger);
				virtual ~ParallelSortContainerMergerTask(void);
				bool operator()(void);
			};

		}
	}
}

#include "ParallelSortContainerMergerTask.tpp"

#endif
